﻿using MesProjectWinform.BasicData.基础实现.chan;
using MesProjectWinform.BasicData.基础实现.chanpin;
using MesProjectWinform.BasicData.基础实现.gongwei;
using MesProjectWinform.BasicData.基础实现.gongyings;
using MesProjectWinform.BasicData.基础实现.kehu;
using MesProjectWinform.BasicData.基础实现.wuliao;
using MesProjectWinform.BasicData.基础实现.显示页面;
using MesProjectWinform.Equipment.Form.DeviceLedger;
using MesProjectWinform.Equipment.Form.DeviceType;
using MesProjectWinform.Equipment.Form.ProjectFrom;
using MesProjectWinform.Equipment.Form.ProjectMaintenance;
using MesProjectWinform.Production.Forms;
using MesProjectWinform.Production.Forms.Packing;
using MesProjectWinform.Production.Forms.ProductLock;
using MesProjectWinform.Public.Form;
using MesProjectWinform.WareHouse.Form.仓库定义;
using MesProjectWinform.WareHouse.Form.外部标签解析;
using MesProjectWinform.WareHouse.Form.工序分类;
using MesProjectWinform.WareHouse.Form.工序管理;
using MesProjectWinform.WareHouse.Form.库位;
using MesProjectWinform.WareHouse.Form.数据维护;
using MesProjectWinform.WareHouse.Form.来料标签打印;
using MesProjectWinform.WareHouse.Form.货位库区;
using System;
using System.Windows.Forms;

namespace MesProjectWinform
{
    public partial class MainForm : DevExpress.XtraBars.Ribbon.RibbonForm
    {
        public MainForm()
        {
            InitializeComponent();
        }

        /// <summary>
        /// 打开指定类型的子窗体，如果已打开则激活，不允许重复打开。
        /// </summary>
        /// <typeparam name="F">要打开的窗体类型，必须继承自XtraForm并有无参构造函数。</typeparam>
        /// <param name="alone">是否只允许单例（true为只允许一个实例）</param>
        private void Disabled<F>(bool alone) where F : DevExpress.XtraEditors.XtraForm, new()
        {
            if (alone)
            {
                // 遍历所有Mdi子窗体，查找是否已存在指定类型的窗体
                foreach (Form form in this.MdiChildren)
                {
                    if (form.GetType() == typeof(F))
                    {
                        // 已存在则激活该窗体并返回
                        form.Activate();
                        return;
                    }
                }
            }
            // 未找到则新建一个窗体实例并显示
            F f = new F();
            f.MdiParent = this;
            f.Show();
        }
        /// <summary>
        /// 车间定义
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void navBarItem1_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            Disabled<chejian>(true);
        }

        /// <summary>
        /// 仓库定义
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void WareHouse_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            Disabled<Form_WareHouse>(true);
        }
        /// <summary>
        /// 产线定义
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void navBarItem3_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            Disabled<chanxian>(true);
        }
        /// <summary>
        /// 工位定义
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        private void navBarItem4_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            Disabled<gongwei>(true);
            
        }
        /// <summary>
        /// 设备类型定义
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DeviceTypeBarItem2_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            Disabled<DeviceTypeForm>(true);
        }
     

        private void MainForm_Load(object sender, EventArgs e)
        {

        }
        /// <summary>
        /// 工单定义
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void navBarItem2_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            Disabled<WorkOrderForm>(true);
        }

        private void navBarItem5_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            Disabled<ProductUnLockForm>(true);
        }

        private void navBarItem6_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            Disabled<PackingForm>(true);
        }
        /// <summary>
        /// 货位定义
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Shelves_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
           Disabled<Form_Shelves>(true);
        }
        /// <summary>
        /// 双击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void navBarControl1_Click1(object sender, EventArgs e)
        {

        }
        /// <summary>
        /// 设备台账定义
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DeviceLedgerBarItem7_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            Disabled<DeviceLedgerForm>(true);
        }
        /// <summary>
        /// 产品锁定定义
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void navBarControl1_Click(object sender, EventArgs e)
        {
            
        }

        /// <summary>
        /// 库位设置
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void navBarItem9_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            Disabled<Form_Location>(true);
        }

        private void navBarItem7_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            Disabled<ProductLockForm>(true);
        }
        /// <summary>
        ///物料
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void navBarItem10_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {

        }
        /// <summary>
        /// 客户
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void navBarItem11_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {

        }

        private void navBarItem42_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            Disabled<DocCodeForm>(true);
        }
        /// <summary>
        /// 物料管理定义
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void navBarItem10_LinkClicked_1(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            Disabled<wuliao>(true);
        }
        /// <summary>
        /// 错误点击
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void navBarItem4_LinkPressed(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {

        }
        /// <summary>
        /// 项目维护定义
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void navBarItem8_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            Disabled<ProjectMaintenanceForm>(true);
        }

        /// <summary>
        /// 客户管理定义
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void navBarItem11_LinkClicked_1(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            Disabled<kehu>(true);
        }
        /// <summary>
        /// 来料标签打印定义
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void navBarItem12_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            Disabled<Form_ShowPrintcs>(true);
        }
        /// <summary>
        /// 原材暂收仓定义
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void navBarItem13_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {

        }
        /// <summary>
        /// 原材料仓定义
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void navBarItem14_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {

        }
        /// <summary>
        /// 成品仓定义
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void navBarItem15_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {

        }
        /// <summary>
        /// 出库记录定义
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void navBarItem16_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {

        }
        /// <summary>
        /// 红牌物料管控定义
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void navBarItem17_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {

        }
        /// <summary>
        /// 备料单插叙定义
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void navBarItem18_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {

        }
        /// <summary>
        /// 物料群组定义
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void navBarItem19_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {

        }
        /// <summary>
        /// 产品物料定义
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void navBarItem20_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            Disabled<chanpin>(true);
        }
        /// <summary>
        /// 替代物料定义
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void navBarItem21_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {

        }
        /// <summary>
        /// BOM定义
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void navBarItem22_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {

        }
        /// <summary>
        /// 不良类型定义
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void navBarItem23_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {

        }
        /// <summary>
        /// 不良现象定义
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void navBarItem24_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {

        }
        /// <summary>
        /// 维修方法定义
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void navBarItem25_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {

        }
        /// <summary>
        /// 技能管理定义
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void navBarItem26_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {

        }
        /// <summary>
        /// 供应商定义
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void navBarItem27_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            Disabled<ying>(true);
        }
        /// <summary>
        /// 假期设置定义
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void navBarItem28_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
           
        }
        /// <summary>
        /// 生产报工定义
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void navBarItem29_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {

        }
        /// <summary>
        /// 报工审核定义
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void navBarItem30_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {

        }
        /// <summary>
        /// 生产领料单查询定义
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void navBarItem31_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {

        }
        /// <summary>
        /// 信息追溯定义
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void navBarItem32_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {

        }
        /// <summary>
        /// 计划排程定义
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void navBarItem33_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {

        }
        
        /// <summary>
        /// 项目表单定义
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void navBarItem34_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            Disabled<ProjectFromForm>(true);
        }
        /// <summary>
        /// 计划配置定义
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void navBarItem35_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {

        }
        /// <summary>
        /// 记录查询定义
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void navBarItem36_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {

        }
        /// <summary>
        /// 故障维护定义
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void navBarItem37_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {

        }
        /// <summary>
        /// 点检保养报告定义
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void navBarItem38_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {

        }
        /// <summary>
        /// 盘点计划定义
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void navBarItem39_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {

        }
        /// <summary>
        /// 盘点记录定义
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void navBarItem40_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {

        }
        /// <summary>
        /// 维修查询定义
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void navBarItem41_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {

        }

        /// <summary>
        /// 外部标签解析
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void NBITagLabel_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            Disabled<Form_TagLable>(true);
        }

        /// <summary>
        /// 工序分类
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void NBIProcessClass_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            Disabled<Form_ProcessClass>(true);
        }

        /// <summary>
        /// 工序管理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void NBIProcessManagement_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            Disabled<Form_ProcessManag>(true);
        }

        /// <summary>
        /// 工艺流程
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void NBIProcess_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {

        }
        /// <summary>
        /// 采购订单
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void NBPurchaseOrder_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {

        }

        /// <summary>
        /// 到货检验
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void NBIArrivalInspection_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {

        }

        /// <summary>
        /// 审批流程
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void NBIApprovalProcess_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {

        }

        /// <summary>
        /// 部门人员职位维护
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void navBarItem9_LinkClicked_1(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            Disabled<Form_DepJobNew>(true);
            
        }
        /// <summary>
        /// 来料标签打印
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void NBITagLabelPrint_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            Disabled<Form_TagLabelPrint>(true);
        }

        /// <summary>
        /// 人员维护
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void NBIEMP_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            Disabled<Form_Emp>(true);
        }
    }
}
